home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tpk-104.zip / TPK.DOC < prev    next >
Text File  |  1993-04-27  |  14KB  |  483 lines

  1.            
  2.            
  3.               -----------------------------------                      
  4.               Turbo Online Programming Kit 
  5.                  Version 1.04
  6.                   By Jason Whittenburg
  7.                  Turbo Programming Team
  8.                 April 27, 1993 
  9.               -----------------------------------                      
  10.            
  11.  
  12.  
  13.      +-----------------------+
  14.      | LICENSING INFORMATION |
  15.      +-----------------------+
  16.  
  17.     This program is not freeware.  This is SHAREWARE which means it is
  18.       user supported software.  If you wish to use these units in your 
  19.       programs you are required to register it.  The registration fee is
  20.       very small at a mere $25.00.
  21.  
  22.     To distrubte any product made with these TPU's you must first
  23.       register this product with T.P.T.
  24.  
  25.     You may not accept compensation for any program for any program made
  26.       with these TPU's without first obtaining a license from T.P.T. for
  27.       compensation.
  28.  
  29.     You may not modify or remove the 'TPK Programming Kit Notice' from
  30.       the program or documentation.
  31.  
  32.     Use of this product constitutes acceptance of these terms.
  33.  
  34.     You will recive a compiled personal copy of TPK on disk when you 
  35.       register.  Updates are available for $3 on disk.
  36.  
  37.      +------------------------------------------+
  38.      | ACKNOWLEDGEMENTS , LEGAL STUFF and MORE! |
  39.      +------------------------------------------+
  40.  
  41.     Thanks to everyone who helped out testing this code and Stats
  42.  
  43.     This programming kit was compiled under Borland Pascal v7 and 
  44.       will function with Borland Pascal v7 in DOS REAL MODE and 
  45.       Turbo Pascal v7.
  46.  
  47.     Most of the commands in this kit will look fimilar to those used
  48.       JPDOOR v3.2 and BOI v2.0.  I made them similar so I would not have 
  49.       to convert my programs I'm working on. :-)  So upgrading copies of
  50.       your programs that use these door kits should not be alot of work.
  51.  
  52.       Borland Pascal is a trademark by Borland International, Inc
  53.       Turbo Pascal is a trademark by Borland International, Inc
  54.       JPDoor is CopyRight 1990-1992 by Motor City Software
  55.       BBS Onliner Interface is Copyright 1992 by Andrew J Mead
  56.      
  57.      +-----------------+
  58.      | GETTING STARTED |
  59.      +-----------------+
  60.  
  61.     TPK is a collection of routines to help you with your door 
  62.       programming.  
  63.       
  64.     TPK takes care of all your communications, etc.  It will not write
  65.       a door for you!  Much programming is required to make any type of  
  66.       online door.  You will most likely require routines not found here, 
  67.       but will the command and procedures here you should be able to easily 
  68.       write your own shells to say display a text file.
  69.  
  70.     To start up the routines of TPK you need to add the following line
  71.       to the main body of your program.  TPK will start up automatically, but
  72.       it still requires at this time for you to run INITALIZE_DOOR.  
  73.  
  74.     Program SomeDoor;
  75.  
  76.     Uses TPK, Multi;
  77.  
  78.     { Bunch of Procedures n' Functions }
  79.     
  80.     Begin { Main Body }
  81.       INITALIZE_DOOR;
  82.       { Your stuff }
  83.     End.
  84.  
  85.      TPK is set up with command line paramators for the drop file and
  86.        other comm related information.  These are...
  87.  
  88.     /S - read DOOR.SYS (GAP, TAG, Renegade, etc style)
  89.     /D - read DORINFOx.DEF
  90.     /L - Local Logon
  91.     
  92.     /C:x  - Lock CommPort
  93.     /I:x  - Lock IRQ
  94.     /B:x  - Lock Baud
  95.     /T:x  - Set Time Limit
  96.     /Q    - Set for Quite mode (No local bell's)   
  97.         <The output routines strip the ^G charactors from strings>
  98.  
  99.       So when you run a program compiled with TPK, at least on of the 
  100.     first three paramaters is required!
  101.  
  102.      +-----------+
  103.      | REFERENCE |
  104.      +-----------+
  105.  
  106.      This section is the reference to all the functions, constants,
  107.        variables and procedures that you may use in your programs.
  108.  
  109.        Constants
  110.        ---------
  111.  
  112.        TPK_Version = '1.04';
  113.       
  114.        Unit Types
  115.        ----------
  116.  
  117.        charset  = set of char;
  118.        commode  = (com_none,com_local,com_internal,com_fossil)
  119.        grmode   = (gr_none,gr_ascii,gr_ansi,gr_avt);
  120.        Str39    = String[39];
  121.        TaskType = (notask,dv,dos5,dos6,win,os2);
  122.        TimeArr  = Array[1..4]of word;
  123.  
  124.        Unit Variables
  125.        --------------
  126.  
  127.       TPK initializes these upon startup, they can be addressed.
  128.  
  129.     AnsiX           Boolean   Color on(true)/off(false)           
  130.     cmode           commode   What coom routines are used?
  131.     GameTime        Integer   Time spent in game so far
  132.     PageLength      byte      Size of the screen in lines     
  133.     RealName        Str39     Users complete Real Name
  134.     StartTime       Timearr   Time that game was initialized
  135.     StartDate       Timearr   Date that game was initialized
  136.     Tasker          TaskType  Operationg System/Enviroment
  137.     TicksLeft       LongInt   Time left in game (18.2 ticks per second)
  138.     Timeexp         Boolean   Time Expired Indicator
  139.     Tstr            String    String Discribing OS/Tasker
  140.     Tvers           Word      Version of OS/Tasker
  141.     UserName        str39     Complete users name (handle)
  142.     
  143.  
  144.       Functions and Procedures
  145.       ------------------------
  146.  
  147.     The following functions and procedures are listed in the format:
  148.       
  149.       =======================================================================
  150.       
  151.       - Function or Procedure Name
  152.       
  153.       - Function or Procedure & Interface Structure
  154.  
  155.       - Description
  156.  
  157.       - Usage Example
  158.  
  159.       - Notes (sometimes)
  160.  
  161.       =======================================================================
  162.  
  163.       Function Center
  164.  
  165.       Center(S:String; I:Byte) : String;
  166.  
  167.       Centers a String (s) on a line (i) units long;
  168.  
  169.       Display(0,7,0,Center('Howdy!',80));
  170.  
  171.       =======================================================================
  172.  
  173.       Procedure CleanString
  174.  
  175.       CleanString(Var Clean : String);
  176.  
  177.       Clears all spaces from the left and right of a string;
  178.  
  179.       Line := '  Hi!  ';
  180.       CleanString(Line);
  181.  
  182.       (line) is now 'Hi!'
  183.              
  184.       =======================================================================
  185.  
  186.       Procedure ClearBuffers
  187.  
  188.       ClearBuffers;
  189.  
  190.       Clears the input buffer.  Good to use before getting input.
  191.  
  192.       =======================================================================
  193.  
  194.       Procedure ClearScreen
  195.  
  196.       ClearScreen;
  197.  
  198.       Clears the remote and local Screens
  199.  
  200.       =======================================================================
  201.  
  202.       Procedure CLRPortEOL
  203.  
  204.       CLRPortEOL;
  205.  
  206.       Clears the remote and local Screens from the curson to the right edge 
  207.       of the screen.
  208.  
  209.       =======================================================================
  210.       
  211.       Function CommaStr
  212.  
  213.       CommaStr(I:LongInt) : String;
  214.  
  215.       Inserts commas into numbers. 
  216.  
  217.       sDisplay(0,7,0,'You have $');
  218.       sDisplay(0,7,0,CommaStr(Money));
  219.       Display(0,7,0,' in the bank');
  220.  
  221.       Output -->  You Have $7,298,232 in the bank
  222.  
  223.       =======================================================================
  224.       
  225.       Procedure CRLF
  226.       
  227.       CRLF;
  228.  
  229.       This porcedure provides a Carrage Return, line feed sequence.
  230.  
  231.       =======================================================================
  232.  
  233.       Function DateDiff
  234.  
  235.       DateDiff(Ubday : String) : real;
  236.       
  237.       Returns the nuber of Julian Days between today and this date.
  238.       Where UBDAY is in the form mm/dd/yy.
  239.  
  240.       DaysPast := DateDiff(birthday);
  241.       
  242.       =======================================================================
  243.  
  244.       Function DateDiff2
  245.  
  246.       DateDiff2(Ubday : String) : real;
  247.       
  248.       Returns the nuber of Julian Days between today and this date.
  249.       Where UBDAY is in the form mmddyy.
  250.  
  251.       DaysPast := DateDiff(birthday);
  252.  
  253.       =======================================================================
  254.       
  255.       Procedure Display      
  256.       
  257.       Display(BackGround, ForeGround, Blink : Byte; Line : String[80]);
  258.  
  259.       This procedure displays the line ('line') to both the local and remote
  260.       screens with a carrage return.  Background and foreground are the 
  261.       color attributes respectivly and blink is 0 for no blinking or 1 for 
  262.       blinking.
  263.  
  264.       Valid colors are standard ansi colors 0-15 and background 0-7
  265.  
  266.     Background Colors:
  267.     0 - Black               3 - Cyan               6 - Brown
  268.     1 - Blue                4 - Red                7 - Light Grey
  269.     2 - Green               5 - Magenta             
  270.  
  271.     Foreground Colors:
  272.     0 - Black       4 - Red          8 - Dark Grey    12 - Light Red
  273.     1 - Blue        5 - Magenta      9 - Light Blue   13 - Light Magenta
  274.     2 - Green       6 - Brown       10 - Light Green  14 - Yellow
  275.     3 - Cyan        7 - Light Grey  11 - Light Cyan   15 - White
  276.  
  277.       Display(0,15,0,'This is a white line');
  278.       Display(0,8,0,SomeStringVariable);
  279.       
  280.       (Also see sDisplay)
  281.  
  282.       =======================================================================
  283.       
  284.       Procedure DiskSp
  285.  
  286.       DiskSp(DriveNum : Integer; Var BytesFree, BytesCap : Real);
  287.  
  288.       Returns the amount of bytes free and bytes capisity on drivenum
  289.       Drive num = Integer where 1 is A:, 2 is B:, etc...
  290.  
  291.       DiskSp(3,free,capisity);
  292.  
  293.  
  294.       =======================================================================
  295.       
  296.       Function Exist
  297.  
  298.       Exist(FileName : String[80]) : Boolean;
  299.  
  300.       Returns a True value if the file specified exists.
  301.       
  302.       If Exist(FileName) then
  303.     Begin
  304.  
  305.       =======================================================================
  306.       
  307.       Procedure GetString
  308.  
  309.       GetString(Var GetStr : String);
  310.  
  311.       Gets string from local or remote screens, like Readln
  312.  
  313.       GetString(InString);
  314.  
  315.       =======================================================================
  316.       
  317.       Procedure GotoPortXY
  318.  
  319.       GotoPortXY(x,y : byte);
  320.  
  321.       Moves the cursor to the X,Y position on the local and remote screens
  322.  
  323.       GotoPort(10,10);
  324.  
  325.       =======================================================================
  326.       
  327.       Procedure Initalize_Door
  328.  
  329.       Initalize_Door;
  330.  
  331.       Initalize the startup routines for TPK and you door, it should be the
  332.       first thing you call.
  333.  
  334.       =======================================================================
  335.       
  336.       Function ITOA
  337.  
  338.       ITOA(I:LongInt) : String;
  339.  
  340.       Converts an Integer to a String
  341.  
  342.       StrValue := ITOA(I);
  343.       Display(0,7,0,ITOA(I));
  344.  
  345.       =======================================================================
  346.       
  347.       Function LeftTime
  348.  
  349.       LeftTime : Integer;
  350.  
  351.       Returns the number of minutes remaining
  352.  
  353.       TimeLeft := Lefttime;
  354.  
  355.       =======================================================================
  356.  
  357.       Function Max
  358.  
  359.       Max(a,b : word) : word;
  360.  
  361.       Returns the larger value of two words;
  362.  
  363.       a:= max(x1,x2);
  364.  
  365.       =======================================================================
  366.  
  367.       Function Min
  368.  
  369.       Min(a,b : word) : word;
  370.  
  371.       Returns the smaller value of two words;
  372.  
  373.       a:= min(x1,x2);
  374.  
  375.       =======================================================================
  376.  
  377.       Procedure Pause_It
  378.  
  379.       Pause_It(x,y,c1,c2,c3,c4 : byte);
  380.  
  381.       Animated Pause.   x = x coord
  382.             y = y coord
  383.             c1 = color #1 (colors are ansi colors 0 - 15)
  384.             c2 = color #2
  385.             c3 = color #3
  386.             c4 = color #4
  387.  
  388.       Pause_it(22,37,11,3,9,1);
  389.  
  390.       =======================================================================
  391.  
  392.       Procedure PortColumnOne
  393.  
  394.       PortColumnOne;
  395.  
  396.       Places cursor at left edge of current line
  397.  
  398.       =======================================================================
  399.  
  400.       Function PortKeyPressed
  401.  
  402.       Until PortKeyPressed;
  403.  
  404.       Replaces BP/TP's KeyPressed function.
  405.  
  406.       Repeat
  407.     { Stuff }
  408.       Until PortKeyPressed
  409.  
  410.       =======================================================================
  411.  
  412.       Procedure PortWindow
  413.  
  414.       PortWindow(x1,y1,x2,y2);
  415.  
  416.       Draw a window on both local and remote screens, replaces TP/BP's 
  417.       Window procedure
  418.  
  419.       PortWindow(1,1,80,25);
  420.  
  421.       =======================================================================
  422.       
  423.       Function ReadPortKey
  424.  
  425.       Input := ReadportKey;
  426.  
  427.       Get input from Remote ot Local Keyboard;
  428.  
  429.       =======================================================================
  430.       
  431.       Function RTOA
  432.  
  433.       RealStr(I:Real; Rsize, Rdec:Byte) : String;
  434.  
  435.       Converts an Real to a String.  Rsize is number of chars and Rdec is
  436.       number of decimal places.
  437.  
  438.       StrValue := RealStr(I,3,1);
  439.       Display(0,7,0,RealStr(I,3,1));
  440.  
  441.       =======================================================================
  442.       Procedure sDisplay      
  443.       
  444.       sDisplay(BackGround, ForeGround, Blink : Byte; Line : String[80]);
  445.  
  446.       This procedure displays the line ('line') to both the local and remote
  447.       screens WITHOUT a carrage return.  Background and foreground are the 
  448.       color attributes respectivly and blink is 0 for no blinking or 1 for 
  449.       blinking.
  450.  
  451.       sDisplay(0,15,0,'This is a white line, with blue exclmation points');
  452.       Display(0,9,0,'!!!');
  453.       
  454.       =======================================================================
  455.       
  456.       Function Valid
  457.  
  458.       Valid(Filename : String[80]) : Boolean;
  459.  
  460.       Returns a true value is the specified string is a valid MS-DOS file
  461.       name.
  462.  
  463.       If Valid(Filename) then
  464.     begin
  465.       If Exist(FileName) then
  466.         begin
  467.  
  468.       =======================================================================
  469.     
  470.       Procedure Wrap
  471.  
  472.       Wrap;
  473.  
  474.       Closes down your door and saves all info.  
  475.      
  476.      
  477.      +-------------+
  478.      | OTHER STUFF |
  479.      +-------------+
  480.  
  481.     Hey, read the product list!!
  482.  
  483.